/*
 * @Descripttion:按需引入echarts
 * @LastEditors: xzh
 * @LastEditTime: 2023-09-15 16:58:40
 */

// 引入 echarts 核心模块
import * as echarts from "echarts/core";

// 按需引入图表-折线图、饼图、柱状图
import { LineChart, BarChart, PieChart } from "echarts/charts";

//按需引入提示框，标题，直角坐标系，数据集，内置数据转换器组件
import {
  TitleComponent,
  TooltipComponent,
  GridComponent,
  DatasetComponent,
  TransformComponent,
  LegendComponent,
  ToolboxComponent,
  DataZoomComponent,
} from "echarts/components";

// 标签自动布局，全局过渡动画等特性
import { LabelLayout, UniversalTransition } from "echarts/features";

// 引入 Canvas 渲染器，注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
import { CanvasRenderer } from "echarts/renderers";

// 注册必须的组件
echarts.use([
  ...[
    TitleComponent,
    TooltipComponent,
    GridComponent,
    DatasetComponent,
    DatasetComponent,
    TransformComponent,
    LegendComponent,
    DataZoomComponent,
    ToolboxComponent,
  ],
  ...[LineChart, BarChart, PieChart],
  ...[CanvasRenderer, LabelLayout, UniversalTransition],
]);

// 导出
export default echarts;
